import random
import time

from base.tools import get_path, upload

from page import DocGdPageHome


# 医生端固定正畸
class DocGdHandle(DocGdPageHome):
    # 点击下一步
    def click_next(self):
        self.get_next_ele().click()
        time.sleep(5)

    def click_fac(self):  # 点击选择加工厂
        self.get_fac_ele().click()

    def fac_choice(self, fac_name):  # 选择要的加工厂
        self.get_use_fac_ele(fac_name).click()

    def click_quick_order(self):  # 快速下单
        self.get_quick_order_ele().click()

    def send_requirement_notes(self):
        self.get_requirement_notes_ele().send_keys("需求备注嗷嗷嗷")

    def click_upload_model(self):  # 点击上传口扫
        self.get_upload_model_ele().click()

    def click_upload_upper(self):  # 上传上颌
        self.get_upload_upper_ele().click()
        upload(rf"{get_path()}\model\UpperJaw.stl")
        time.sleep(1)

    def click_upload_lower(self):  # 上传下颌
        self.get_upload_lower_ele().click()
        upload(rf"{get_path()}\model\LowerJaw.stl")
        time.sleep(1)

    def text_upload_success(self):
        self.get_upload_success_ele()

    def click_ok_ele(self):
        self.get_ok_ele().click()

    def click_recent_visit(self):  # 点击最近访问
        self.get_recent_visit_ele().click()

    def click_technician(self, js_name):  # 点击技师
        self.get_technician_ele(js_name).click()

    def click_submit(self):
        self.get_submit_ele().click()

    def text_submit_success(self):
        self.get_submit_success_ele()

    # 医生查看方案
    def click_search1_js_ele(self):  # 查询
        self.get_search1_js_ele().click()

    def click_search2_js_ele(self):  # 筛选方案审核数据
        self.get_search2_js_ele().click()

    def click_search_js_button_ele(self):  # 查询
        self.get_search_js_button_ele().click()

    def click_see_ele(self):
        self.get_see_ele().click()

    def click_view_scenarios_ele(self):  # 播放方案
        self.get_view_scenarios_ele().click()
        time.sleep(30)

    def click_permission1_ele(self):  # 批准方案
        self.get_permission1_ele().click()

    def click_permission2_ele(self):  # 确认批准
        self.get_permission2_ele().click()

    def click_close_ele(self):  # 关闭方案
        self.get_close_ele().click()

    def text_success_ele(self):  # 校验方案有没有加载完成
        self.get_success_ele()
